#!/user/bin/env python3
# -*- coding: utf-8 -*-
# author:YaFans
'''
字符串重复统计
    字符表'abcdefghijklmnopqrstuvwxyz'
    随机挑选2个字母组成字符串，共挑选100个
    降序输出所有不同的字符串及重复的次数
'''
import random

s1 = 'abcdefghijklmnopqrstuvwxyz'
l1 = [''.join(random.choices(s1,k=2)) for _ in range(100)]
d = {}

for i in l1:
    if not d.get(i):
        d[i] = 1
    else:
        d[i] += 1


result = sorted(d.items(),key=lambda items:items[1],reverse=True)
print(result)

# 做得很好
